﻿
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JmShared
{
    
    public class ChatGroup : IEquatable<ChatGroup>
    {
        
        public string ID { get; set; }
        
        public string Name { get; set; }
        public int MemberCount
        {
            get
            {
                return GroupMembers != null ? GroupMembers.Count : 0;
            }
        }
        public Dictionary<string, GroupPrivilege> GroupMembers;
        //public string OwnerUsername { get; set; }


        public ChatGroup(string id, string name,Dictionary<string,GroupPrivilege> groupMembers)
        {
            this.ID = id;
            this.Name = name;
            this.GroupMembers = groupMembers;
        }

        public ChatGroup(string id, string name)
        {
            this.ID = id;
            this.Name = name;
        }
        private ChatGroup() { }
        public override bool Equals(object obj)
        {
            return Equals(obj as ChatGroup);
        }
        public override int GetHashCode()
        {
            return this.ID.GetHashCode();
        }
        public bool Equals(ChatGroup other)
        {
            if (other == null)
                return false;
            return this.ID == other.ID;
        }
    }
}
